public class Offer_10_1 {

    public static int fib(int n) {
        if(n==0){
            return 0;
        }
        if(n==1){
            return 1;
        }
        int num1=0,num2=1,sum=0;
        while(n>=2){
            sum=(num1+num2)%1000000007;
            num1=num2;
            num2=sum;
            n--;
        }
        return sum;
    }

    public static int fib1(int n) {
        if(n==0){
            return 0;
        }
        if(n==1){
            return 1;
        }

        return fib1(n-1)+fib1(n-2);
    }
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(fib(i));
            System.out.println(fib1(i));
        }
    }
}
